#ifndef MULTICASTSOCKET_H
#define MULTICASTSOCKET_H

#include <QObject>
#include <QUdpSocket>
#include <QHostAddress>
#include <vector>
#include <complex>
#include <cmath>
class MulticastSocket : public QObject {
    Q_OBJECT

public:
    explicit MulticastSocket(const QHostAddress& group, quint16 port, bool isSender, QObject *parent = nullptr);

    void send(const QByteArray &data);

signals:
    void dataReceived(const QByteArray &data);
    void processingCompleted(const std::vector<std::complex<double>>& result);

    private slots:
    void readPendingDatagrams();

private:
    QUdpSocket *socket_;
    QHostAddress group_;
    quint16 port_;
    bool isSender_;
};

#endif // MULTICASTSOCKET_H